<template>
  <div class="page">
    <van-nav-bar
      :z-index="999"
      :fixed="true"
      left-arrow
      @click-left="onClickLeft"
      :placeholder="true"
      title="我的合同"
    ></van-nav-bar>
    <div class="my-account">
      <img :src="baseURL + pact.tx" alt />
    </div>
    <!-- 账户信息 -->
    <my-public />
    <!-- 合同 -->
    <div class="my-pact">
      <iframe v-if="pact.htlj" :src="pact.htlj"></iframe>
      <div v-else>未上传您的合同文件，待驾校上传后查看</div>
      <!-- <img :src="baseURL+pact.data" alt /> -->
      <!-- <img src="../../assets/images/57.jpg" alt /> -->
    </div>
  </div>
</template>

<script>
import { userContract, DoubleCounting } from "../../assets/js/api/user";
import { baseURL } from "../../assets/js/config";
import MyPublic from "./MyPublic.vue";
export default {
  name: "MyPact",
  data() {
    return {
      pact: {},
      baseURL: "",
      next: false // 验证是否通过
    };
  },

  mounted() {
    DoubleCounting().then(res => {
      if (res.code == 501) {
        this.next = true;
      }
    });

    this.baseURL = baseURL;
    userContract().then(res => {
      // console.log(res);
      if (res.code == 0) {
        this.pact = res.data;
        // console.log(this.pact);
      }
    });
  },
  components: {
    MyPublic
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    }
  },
  created() {
    let dsBridge = require("dsbridge");
    dsBridge.call("goBack", "", function() {
      history.go(-1);
    });
  }
};
</script>

<style></style>
